Cope with the ValueError exception that we get if you use Xend with the recent
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 9 Nov 2005 15:08:37 +0000 (16:08 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 9 Nov 2005 15:08:37 +0000 (16:08 +0100)
change to parsing memory configuration against a store with entries written
by an older Xend.

Added maxmem field to list of things to be read from the store on recreate.

tools/python/xen/xend/XendDomainInfo.py

index 54dfeac28ea0014a3c7a9b61ea5a677d43541b30..1e06748d5db98b9a3976693dcbeec3d72f02a47f 100644 (file)
@@ -393,11 +393,22 @@ class XendDomainInfo:
                   ("on_crash",     str),
                   ("image",        str),
                   ("memory",       int),
+                  ("maxmem",       int),
                   ("vcpus",        int),
                   ("vcpu_avail",   int),
                   ("start_time", float))
 
-        from_store = self.gatherVm(*params)
+        try:
+            from_store = self.gatherVm(*params)
+        except ValueError, exn:
+            # One of the int/float entries in params has a corresponding store
+            # entry that is invalid.  We recover, because older versions of
+            # Xend may have put the entry there (memory/target, for example),
+            # but this is in general a bad situation to have reached.
+            log.exception(
+                "Store corrupted at %s!  Domain %d's configuration may be "
+                "affected.", self.vmpath, self.domid)
+            return
 
         map(lambda x, y: useIfNeeded(x[0], y), params, from_store)